#!/bin/sh

message_server_error_limit() {
	echo ' > With its latest release `pacman` now supports a server error limit,'
	echo ' > which breaks `pacredir`. Rebuild `pacman` with that feature disabled'
	echo ' > or install from this repository:'
	echo ' >   [pacredir]'
	echo ' >   Server = https://pkgbuild.com/~eworm/$repo/$arch/'
}

post_install() {
	echo ' > For instructions visit: https://github.com/eworm-de/pacredir#usage'
	message_server_error_limit
}

post_upgrade() {
	# nothing is stored by pacredir, so restarting is safe
	systemctl try-restart pacredir.service

	# return if old package version greater 0.4.4-0...
	(( $(vercmp $2 '0.4.4-0') > 0 )) && return

	message_server_error_limit
}
